<me:UIGLLG x:Class="WPFExcelReport.TCPGB02"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"   
                    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
                    xmlns:me="clr-namespace:WPFExcelReport"  
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"    
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"  
                    x:Name="TV" 
                    Loaded="Window_Loaded"
     >
    <me:UIGLLG.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <CollectionViewSource   x:Key="vwGLLG" />
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:KM2YD x:Key="KM2YD"/>
        <ucd:BM2YD x:Key="BM2YD"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIGLLG.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel >
            <WrapPanel >
                <Label Content="{Binding Source={Localization:Translate Word=库：}}"    Width="30" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="14" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox  Text="{Binding LO,ElementName=TV}" Name="txtLO" Width="31" Margin="5,0,0,0"  HorizontalAlignment="Left" Background="Pink" Panel.ZIndex="1"
                          KeyUp="txtLO_KeyUp"  CharacterCasing="Upper" MaxLength="10" FontSize="18" Foreground="#FF141111" Height="33" />
                <Label Content="{Binding Source={Localization:Translate Word=库区：}}"    Width="40" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="14" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Text="{Binding LB,ElementName=TV}" Name="txtLB" Width="31" Margin="5,0,0,0"  HorizontalAlignment="Left" Background="Pink" Panel.ZIndex="2"
                           KeyUp="txtLO_KeyUp"  CharacterCasing="Upper" MaxLength="6" FontSize="18" Foreground="#FF141111" Height="33" />
                <Label Content="{Binding Source={Localization:Translate Word=库位：}}"    Width="40" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="14" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Text="" Name="txtLP" Width="31" Margin="5,0,0,0"  HorizontalAlignment="Left" Background="Pink" Panel.ZIndex="2"
                           KeyUp="txtLO_KeyUp"  CharacterCasing="Upper" MaxLength="6" FontSize="14" Foreground="#FF141111" Height="33" /> 
                <Label Content="{Binding Source={Localization:Translate Word=批号}}"    Width="40" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="14" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox  Text="{Binding KEY,ElementName=TV}"   Width="100" Margin="5,0,0,0"  HorizontalAlignment="Left" Background="Pink" Panel.ZIndex="1"
                          KeyUp="txtLO_KeyUp"  CharacterCasing="Upper" MaxLength="10" FontSize="14" Foreground="#FF141111" Height="33" />
                <Label Visibility="Collapsed" Content="{Binding Source={Localization:Translate Word=品种}}"    Width="40" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="14" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Visibility="Collapsed" Text="{Binding ART,ElementName=TV}"   Width="120" Margin="5,0,0,0"  HorizontalAlignment="Left" Background="Pink" Panel.ZIndex="1"
                          KeyUp="txtLO_KeyUp"  CharacterCasing="Upper" MaxLength="20" FontSize="14" Foreground="#FF141111" Height="33" />
                <Label Visibility="Collapsed" Content="{Binding Source={Localization:Translate Word=色号}}"    Width="40" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="14" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Visibility="Collapsed" Text="{Binding FARBE,ElementName=TV}"   Width="100" Margin="5,0,0,0"  HorizontalAlignment="Left" Background="Pink" Panel.ZIndex="1"
                          KeyUp="txtLO_KeyUp"  CharacterCasing="Upper" MaxLength="10" FontSize="14" Foreground="#FF141111" Height="33" />
                <Button Content="{Binding Source={Localization:Translate Word=查询}}" Height="33" Margin="10,0,0,0"   Width="96" Panel.ZIndex="9"
                        Click="QueryCommand"/>
            </WrapPanel>
        </StackPanel>
        <StackPanel Grid.Row="1" > 
            <WrapPanel>
                <Button FontSize="18" Width="30" Height="30" Margin="0,0,0,0" Name="btnBook"  Click="btnAllocate_Click"  >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                    </Button.Background>
                </Button>
                <TextBlock   Grid.Row="1" Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="{Binding Source={Localization:Translate Word=留位}}"  VerticalAlignment="Center" />
                <Button Grid.Column="0" FontSize="18" Width="30" Height="30" Margin="50,0,0,0" Name="btnRemoveBook"   Visibility="Collapsed" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Delete.png" />
                    </Button.Background>
                </Button>
                <TextBlock Visibility="Collapsed" Grid.Column="1" VerticalAlignment="Center" Text="{Binding Source={Localization:TranslateExtension Word=取消}}"></TextBlock>
            </WrapPanel>
        </StackPanel>

        <DataGrid  Grid.Row="2" Grid.Column="0" 
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"
                   Name="dlgMaster"
                   ItemsSource="{Binding Source={StaticResource vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                    >
            <DataGrid.Columns>
                <DataGridCheckBoxColumn Width="40" Binding="{Binding Path=IsSelected,RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type DataGridRow}}}">
                    <DataGridCheckBoxColumn.HeaderTemplate>
                        <DataTemplate>
                            <CheckBox x:Name="ckbSelectedAll" Checked="ckbSelectedAll_Click" Unchecked="ckbSelectedAll_Unchecked"></CheckBox>
                        </DataTemplate>
                    </DataGridCheckBoxColumn.HeaderTemplate>
                </DataGridCheckBoxColumn>
                <!--GLLO,GLLB,GLLP,GPSPPART,GPGART,GPGFARBE,GLBSTKG,QLOCK,QFREE-->
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=库}}" Binding="{Binding GLLO}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=库区}}" Binding="{Binding GLLB}" Width="Auto"/>
                <DataGridTextColumn   Header="{Binding Source={Localization:Translate Word=库位}}"   Binding="{Binding GLLP}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=批号}}" Binding="{Binding GPSPPART,Converter={StaticResource ResourceKey=gb2312}}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=品种}}" Binding="{Binding GPGART}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=色号}}" Binding="{Binding GPGFARBE, Converter={StaticResource ResourceKey=gb2312}}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=库存}}" Binding="{Binding GLBSTKG}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=留位}}" Binding="{Binding QLOCK}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=自由}}" Binding="{Binding QFREE}"/>
            </DataGrid.Columns>
        </DataGrid  > 
    </Grid> 
</me:UIGLLG>
